package com.interfaces;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.entity.Ope;



/**   
* @author   孙梦楠
* @date 	2017年7月12日 下午5:43:18 
* @version  V1.0.0   
*/

public interface OpeDao extends JpaRepository<Ope, Integer>{
	
	Ope findByOpecodeAndOpepassword(String opecode,String opepassword);

	Ope findByOpecode(String opecode);
	
	Ope findByOpeorg(Integer opeorg);
	
	@Transactional
	@Modifying 
    @Query(value="SELECT * FROM e_ope WHERE ope_isdel=0",nativeQuery=true)
    List<Ope> listall();
	
	
	//更新短信
	@Transactional
	@Modifying 
    @Query("update Ope eo  set eo.opeverification = ?1 where eo.opecode = ?2")
    int updateOpeverification(String opeverification , String opecode);
	
	@Transactional
	@Modifying
	@Query("update Ope eo  set eo.opeisdel = ?1 where eo.opeid = ?2")
	int updateOpeisdel(Byte opeisdel, Integer opeid);
	
	@Transactional
	@Modifying
	@Query("update Ope eo  set eo.opepassword = ?1 where eo.opeid = ?2")
	int updatePassword(String opepassword, Integer opeid);
}
